package com.zzx.config;

import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
public class ErrorHandler {

	@ExceptionHandler(Exception.class)
	@ResponseBody
	public Object handleAll(Exception e) {
		return "赶紧给项目经理打电话，别睡了，再睡就天亮了"+e.getClass();
	}
	
	@ExceptionHandler(NullPointerException.class)
	//@ResponseBody
	public Object handerNullPoint(Exception e,Model model) {
		model.addAttribute("e",e);
		return "error/null";  //error/null.jsp
	}
	
}
